package com.lrr.community.mapper;

import com.lrr.community.dto.GithubUser;
import com.lrr.community.model.User;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

@Mapper
public interface UserMapper {



    @Insert("insert into user (name,account_id,token,gmt_create,gmt_modified,avatar_url,bio) " +
            "values (#{name},#{account_id},#{token},#{gmt_create},#{gmt_modified},#{avatar_url},#{bio})")
    public void insert(User user);
    @Select("select * from user where token = #{token}")
    public User findByToken(@Param("token") String token);

    @Select("select * from user where id = #{id}")
    User findById(@Param("id") Integer id);

    @Select("select * from user where account_id = #{account_id}")
    User findByAcctounId(@Param("account_id") String account_id);

    @Update("update user set name = #{name},avatar_url=#{avatar_url},gmt_modified=#{gmt_modified},token =#{token} where id = #{id}")
    void update(User dbUser);
}
